<?xml version="1.0" encoding="UTF-8" ?>
<!-- jsf:pagecode language="java" location="/src/pagecode/Tecajnice.java" --><!-- /jsf:pagecode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<ui:composition template="layout/pageLayout.xhtml">

	<ui:define name="content">


		<p:fieldset legend="Parametri iskanja" toggleable="true"
			toggleSpeed="500">
			<h:form id="VnosParamtrov">
				<p:growl id="growl" showDetail="true" life="5000" />
				<p:panelGrid>
					<p:row>
						<p:column>
							<h:outputLabel value="Izberi vrsto tečajnice: "
								for="izbiraVrsteTecajnice" />
						</p:column>
						<p:column>
							<p:selectOneMenu id="izbiraVrsteTecajnice"
								value="#{tecajnice.sifraIzbraneVrstaTecajnice}" effect="fade"
								required="true">
								<f:selectItems value="#{tecajnice.seznamVrstTecajnic}"
									var="vrstaTecajnice"
									itemValue="#{vrstaTecajnice.sifraVrsteTecajnice}"
									itemLabel="#{vrstaTecajnice.nazivVrsteTecajnice}" />
							</p:selectOneMenu>
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<h:outputLabel value="Izberi datum: " for="izbiraDatuma" />
						</p:column>
						<p:column>
							<p:calendar id="izbiraDatuma" value="#{tecajnice.izbranDatum}"
								navigator="true" display="inline" required="true">
							</p:calendar>
						</p:column>
					</p:row>
					<p:row>
						<p:column colspan="2">
							<h:commandButton value="Prikazi tecajnico"
								action="#{tecajnice.poisciTecajnico}"
								update="testPrikazTecajnice" />
						</p:column>
					</p:row>
				</p:panelGrid>
			</h:form>
		</p:fieldset>
		<br />

		<c:if id="testPrikazTecajnice" test="#{tecajnice.tecajnicaIzbrana}">
			<p:fieldset legend="Rezultati iskanja">
				<h:form>
					<p:growl id="growl" showDetail="true" life="5000" />
					<p:dataTable var="tecaj"
						value="#{tecajnice.izbranaTecajnica.tecaji}"
						emptyMessage="Tečajnic s temi kriteriji ni bilo mogoče najti."
						rows="15" rowsPerPageTemplate="5,10,20,50,100" paginator="true">
						<p:column id="Valuta" headerText="Valuta"
							filterBy="#{tecaj.valuta.oznakaValute}"
							filterMatchMode="contains" style="text-align: center">
							<h:outputText value="#{tecaj.valuta.oznakaValute}" />
						</p:column>

						<c:if test="#{tecajnice.srednjiTecajiNapolnjeni}">
							<p:column headerText="Srednji tečaj" style="text-align: center">
								<h:outputText value="#{tecaj.srednjiTecaj}" />
							</p:column>
						</c:if>
						<c:if test="#{tecajnice.nakupniTecajiNapolnjeni}">
							<p:column headerText="Nakupni tečaj" style="text-align: center">
								<h:outputText value="#{tecaj.nakupniTecaj}" />
							</p:column>
						</c:if>
						<c:if test="#{tecajnice.prodajniTecajiNapolnjeni}">
							<p:column headerText="Prodajni tečaj" style="text-align: center">
								<h:outputText value="#{tecaj.prodajniTecaj}" />
							</p:column>
						</c:if>
					</p:dataTable>
				</h:form>
			</p:fieldset>
		</c:if>
	</ui:define>
</ui:composition>
</html>